package ca.uwaterloo.titslongcall;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

public class ContactActivity extends Activity{
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_contact);
		Button addthiscontact = (Button) findViewById(R.id.addcontact);
		final EditText name = (EditText) findViewById(R.id.name);
		final EditText phone = (EditText) findViewById(R.id.number);
		addthiscontact.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				String Name = name.getText().toString();
				String Phone = phone.getText().toString();
				if (!(Name.equals("")||Phone.equals(""))){
					Intent returnact = new Intent();
					returnact.putExtra("contactName", Name);
					returnact.putExtra("contactPhone", Phone);
					setResult(RESULT_OK, returnact);
					finish();
				}
			}
		});
	}

}
